package com.yuanchu.store.controller;

import com.yuanchu.common.utils.R;
import com.yuanchu.store.entity.YoshopRegionEntity;
import com.yuanchu.store.service.YoshopRegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-02-19 15:30
 */
@Api(value = "RegionController", tags = {"省市区数据接口"})
@RestController
@RequestMapping("region")
public class RegionController {

    @Resource
    private YoshopRegionService regionService;


    @ApiOperation("查询树形节点地址")
    @GetMapping("/tree")
    public R queryRegionTreeAddress() {
        Map<Integer, YoshopRegionEntity> list = regionService.queryRegionTreeAddress();
        Map<String, Object> map = new HashMap<>();
        map.put("list", list);
        return R.ok().put("data", map);
    }
}
